package com.jaydenxiao.common.commonutils;

import java.text.DecimalFormat;

/**
 * des:金钱
 * Created by xsf
 * on 2016.06.11:48
 */
public class MoneyUtil {
    public static String MoneyFomatWithTwoPoint(double d){
        DecimalFormat df = new DecimalFormat("#.##");
        return df.format(d);
    }

    /**
     * 保留2位小数
     * @param scale
     * @return
     */
    public static  String floatWithPoint(float scale){
        DecimalFormat   fnum=null;
        try {
            fnum  =   new  DecimalFormat("##0.00");
            return  fnum.format(scale);
        }catch (Exception e){
            e.printStackTrace();
        }

        return  "0.00";
    }
}
